package cn.fzm.demo01;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

/**
 * @author Dremeue
 * @create 2019-09-27 10:15
 **/
@Component(value = "myBook")
@Aspect
public class MyBook {

    @Before(value = "execution(* cn.fzm.demo01.Book.*(..))")
    public void before1() {
        System.out.println("mybook add...");
    }

    @After(value = "execution(* cn.fzm.demo01.Book.*(..))")
    public void after1() {
        System.out.println("mybook after...");
    }

    @Around(value = "execution(* cn.fzm.demo01.Book.*(..))")
    public void around(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
        System.out.println("mybook around before...");
        proceedingJoinPoint.proceed();
        System.out.println("mybook around after...");
    }
}
